home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / FRACTAL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-07  |  4.5 KB  |  118 lines

  1. /****************************************************************************
  2. *                   fractal.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for FRACTAL.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24. #ifndef FRACTAL_H
  25. #define FRACTAL_H
  26.  
  27. /*****************************************************************************
  28. * Global preprocessor defines
  29. ******************************************************************************/
  30.  
  31. #define QUATERNION_TYPE    0
  32. #define HYPERCOMPLEX_TYPE  1
  33.  
  34. /* Hcmplx function stypes must come first */
  35. #define EXP_STYPE          0
  36. #define LOG_STYPE          1
  37. #define SIN_STYPE          2
  38. #define ASIN_STYPE         3
  39. #define COS_STYPE          4
  40. #define ACOS_STYPE         5
  41. #define TAN_STYPE          6
  42. #define ATAN_STYPE         7
  43. #define SINH_STYPE         8
  44. #define ASINH_STYPE        9
  45. #define COSH_STYPE        10
  46. #define ACOSH_STYPE       11
  47. #define TANH_STYPE        12
  48. #define ATANH_STYPE       13
  49. #define PWR_STYPE         14
  50.  
  51. /* end function stypes */
  52. #define SQR_STYPE         15
  53. #define CUBE_STYPE        16
  54. #define RECIPROCAL_STYPE  17
  55.  
  56. #define Iteration(V,F) ( (*((F)->Iteration_Method))(V,F) )
  57. #define Normal_Calc(F,V) ( (*((F)->Normal_Calc_Method))(V,(F)->n,F) )
  58. #define F_Bound(R,F,dm,dM) ( (*((F)->F_Bound_Method))(R,F,dm,dM) )
  59. #define D_Iteration(V,F,D) ( (*((F)->D_Iteration_Method))(V,F,D) )
  60. #define Complex_Function(t,s,F) ( (*((F)->Complex_Function_Method))(t,s) )
  61.  
  62. /*****************************************************************************
  63. * Global typedefs
  64. ******************************************************************************/
  65.  
  66. typedef struct Fractal_Struct FRACTAL;
  67. typedef struct cmplx { DBL x,y; } CMPLX;
  68. typedef void (*NORMAL_CALC_METHOD) PARAMS((VECTOR, int, FRACTAL *));
  69. typedef int (*ITERATION_METHOD) PARAMS((VECTOR, FRACTAL *));
  70. typedef int (*D_ITERATION_METHOD) PARAMS((VECTOR, FRACTAL *, DBL *));
  71. typedef int (*F_BOUND_METHOD) PARAMS((RAY *, FRACTAL *, DBL *, DBL *));
  72. typedef void (*COMPLEX_FUNCTION_METHOD) PARAMS((CMPLX *, CMPLX *));
  73.  
  74. struct Fractal_Struct
  75. {
  76.   OBJECT_FIELDS
  77.   TRANSFORM * Trans;
  78.   VECTOR Center;
  79.   DBL Julia_Parm[4];
  80.   DBL Slice[4];                 /* vector perpendicular to slice plane */
  81.   DBL SliceDist;                /* distance from slice plane to origin */
  82.   DBL Exit_Value;
  83.   int n;                        /* number of iterations */
  84.   DBL Precision;                /* Precision value */
  85.   int Inverted;
  86.  
  87.   int Algebra;                  /* Quaternion or Hypercomplex */
  88.   int Sub_Type;
  89.   CMPLX exponent;               /* exponent of power function */
  90.  
  91.   NORMAL_CALC_METHOD Normal_Calc_Method;
  92.   ITERATION_METHOD Iteration_Method;
  93.   D_ITERATION_METHOD D_Iteration_Method;
  94.   F_BOUND_METHOD F_Bound_Method;
  95.   COMPLEX_FUNCTION_METHOD Complex_Function_Method;
  96.  
  97.   DBL Radius_Squared;           /* For F_Bound(), if needed */
  98. };
  99.  
  100. /*****************************************************************************
  101. * Global variables
  102. ******************************************************************************/
  103.  
  104. extern DBL *Sx, *Sy, *Sz, *Sw;
  105. extern DBL Precision;
  106. extern VECTOR Direction;
  107.  
  108. /*****************************************************************************
  109. * Global functions
  110. ******************************************************************************/
  111.  
  112. FRACTAL *Create_Fractal PARAMS((void));
  113. void SetUp_Fractal PARAMS((FRACTAL * Fractal));
  114. void Allocate_Iteration_Stack PARAMS((int n));
  115. void Free_Iteration_Stack PARAMS((void));
  116.  
  117. #endif
  118.